package com.flexycore.iphone.view;

import com.flexycore.iphone.coregraphics.CGRect;
import com.flexycore.iphone.uikit.UIButton;
import com.flexycore.iphone.uikit.UIControlEvents;
import com.flexycore.iphone.uikit.UIImage;
import com.flexycore.iphone.uikit.UIView;

/**
 * 
 * @author matthieu nicolazo
 *
 */
public class SelectNoteView extends UIView {
	
	/**
	 * Constructor
	 */
	public SelectNoteView(){
		super();
		initWithFrame(new CGRect().init(0, 0, 320, 200));
		
		UIButton button = new UIButton() {
			/*
			 *  Boolean managing selected status
			 */
			private boolean isSelected = false;
			@Override
			public void controlEvent() {
				if(isSelected){
					this.setImageForState(UIImage.imageNamed("button.png"), 0);
					isSelected = false;
				} else {
					this.setImageForState(UIImage.imageNamed("button_selected.png"), 0);
					isSelected = true;
				}
			}
		};
		button.initWithFrame(new CGRect().init(145, 50, 32, 32));
		button.setImageForState(UIImage.imageNamed("button.png"), 0);
		button.addTargetActionForControlEvents(UIControlEvents.UIControlEventTouchUpInside);
		addSubview(button);
	}
	
}
